package scala.caseClass

class Logger {

   def log(level: Int, l: LogMessage) {
      l match {
         case StringMessage(msg)          => println(msg)
         case ExceptionMessage(ex: Error) => ex.printStackTrace
         case ExceptionMessage(ex)        => println(ex.toString)
         case _                           =>
      }
   }

   def debug(l: LogMessage) = log(10, l)
   def info(l: LogMessage) = log(5, l)
   def error(l: LogMessage) = log(1, l)
}

object Logger {
   def main(args: Array[String]): Unit = {
      println("t")
   }
}

//that will causes error , create case class as subclass of a sealed class
// mush be declared in the same source file where declare the sealed class
// -> case class AnotherLogger(l: String) extends LogMessage